/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function loadXMLDoc(dname)
{
    if (window.XMLHttpRequest)
    {
        xhttp=new XMLHttpRequest();
    }
    else
    {
        xhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xhttp.open("GET",dname,false);
    xhttp.send("");
    return xhttp.responseXML;
}
function displayAllEncomendas()
{
    try{
        xml=loadXMLDoc("consulta?action=getAllEncomendas",false);
        xsl=loadXMLDoc("xml/consulta.xsl",false);
              
        // code for IE
        if (window.ActiveXObject)
        {
            ex=xml.transformNode(xsl);
            document.getElementById("encomendasDiv").innerHTML=ex;
        }
        // code for Mozilla, Firefox, Opera, etc.
        else if (document.implementation && document.implementation.createDocument)
        {
            xsltProcessor=new XSLTProcessor();
            xsltProcessor.importStylesheet(xsl);
            resultDocument = xsltProcessor.transformToFragment(xml,document);
            document.getElementById("encomendasDiv").appendChild(resultDocument);
            
        }
    }catch(err){
        alert(err);
    }
}